package ch07_GUI编程;

import javax.swing.*;
import java.awt.*;

public class BorderLayoutDemo {
	public static void main(String[] args) {
		new BorderLayoutDemo().init();
	}
	void init() {
		BaseFrame f = new BaseFrame("BorderLayout Demo");
		f.setLayout(new BorderLayout());
		
		JButton b1 = new JButton("东");
		JButton b2 = new JButton("西");
		JButton b3 = new JButton("南");
		JButton b4 = new JButton("北");
		JButton b5 = new JButton("中");
		
		f.add(b1,BorderLayout.EAST);
		f.add(b2,BorderLayout.WEST);
		f.add(b3,BorderLayout.SOUTH);
		f.add(b4,BorderLayout.NORTH);
		f.add(b5,BorderLayout.CENTER);
		
		f.setIconImage(new ImageIcon("images/compass.png").getImage());
		f.showMe();
	}
}
